/*
 * @Author: Sam
 * @Date: 2021-07-22 09:47:05
 * @LastEditTime: 2021-07-22 10:12:47
 * @LastEditors: Sam
 * @Description:
 * @FilePath: \resourcesf:\thework\tofba-client\src\utils\getState.js
 * 可以输入预定的版权声明、个性签名、空行等
 */
const state = [
  {
    "countryCode": "US",
    "stateProvince": [
      {
        "nameCn": "阿拉巴马州",
        "nameEn": "Alabama",
        "code": "AL"
      },
      {
        "nameCn": "阿拉斯加州",
        "nameEn": "Alaska",
        "code": "AK"
      },
      {
        "nameCn": "阿肯色州",
        "nameEn": "Arkansas",
        "code": "AR"
      },
      {
        "nameCn": "亚利桑那州",
        "nameEn": "Arizona",
        "code": "AZ"
      },
      {
        "nameCn": "加利福尼亚州",
        "nameEn": "California",
        "code": "CA"
      },
      {
        "nameCn": "科罗拉多州",
        "nameEn": "Colorado",
        "code": "CO"
      },
      {
        "nameCn": "康涅狄格州",
        "nameEn": "Connecticut",
        "code": "CT"
      },
      {
        "nameCn": "特拉华州",
        "nameEn": "Delaware",
        "code": "DE"
      },
      {
        "nameCn": "哥伦比亚特区",
        "nameEn": "District of Columbia",
        "code": "DC"
      },
      {
        "nameCn": "佛罗里达州",
        "nameEn": "Florida",
        "code": "FL"
      },
      {
        "nameCn": "乔治亚州",
        "nameEn": "Georgia",
        "code": "GA"
      },
      {
        "nameCn": "夏威夷",
        "nameEn": "Hawaii",
        "code": "HI"
      },
      {
        "nameCn": "爱达荷州",
        "nameEn": "Idaho",
        "code": "ID"
      },
      {
        "nameCn": "伊利诺斯州",
        "nameEn": "Illinois",
        "code": "IL"
      },
      {
        "nameCn": "印地安那州",
        "nameEn": "Indiana",
        "code": "IN"
      },
      {
        "nameCn": "爱荷华州",
        "nameEn": "Iowa",
        "code": "IA"
      },
      {
        "nameCn": "堪萨斯州",
        "nameEn": "Kansas",
        "code": "KS"
      },
      {
        "nameCn": "肯塔基州",
        "nameEn": "Kentucky",
        "code": "KY"
      },
      {
        "nameCn": "路易斯安那州",
        "nameEn": "Louisiana",
        "code": "LA"
      },
      {
        "nameCn": "缅因州",
        "nameEn": "Maine",
        "code": "ME"
      },
      {
        "nameCn": "马里兰州",
        "nameEn": "Maryland",
        "code": "MD"
      },
      {
        "nameCn": "麻萨诸塞州",
        "nameEn": "Massachusetts",
        "code": "MA"
      },
      {
        "nameCn": "密歇根州",
        "nameEn": "Michigan",
        "code": "MI"
      },
      {
        "nameCn": "明尼苏达州",
        "nameEn": "Minnesota",
        "code": "MN"
      },
      {
        "nameCn": "密西西比州",
        "nameEn": "Mississippi",
        "code": "MS"
      },
      {
        "nameCn": "密苏里州",
        "nameEn": "Missouri",
        "code": "MO"
      },
      {
        "nameCn": "蒙大拿州",
        "nameEn": "Montana",
        "code": "MT"
      },
      {
        "nameCn": "内布拉斯加州",
        "nameEn": "Nebraska",
        "code": "NE"
      },
      {
        "nameCn": "内华达州",
        "nameEn": "Nevada",
        "code": "NV"
      },
      {
        "nameCn": "新罕布什尔州",
        "nameEn": "New Hampshire",
        "code": "NH"
      },
      {
        "nameCn": "新泽西州",
        "nameEn": "New Jersey",
        "code": "NJ"
      },
      {
        "nameCn": "新墨西哥州",
        "nameEn": "New Mexico",
        "code": "NM"
      },
      {
        "nameCn": "纽约州",
        "nameEn": "New York State",
        "code": "NY"
      },
      {
        "nameCn": "北卡罗来纳州",
        "nameEn": "North Carolina",
        "code": "NC"
      },
      {
        "nameCn": "北达科他州",
        "nameEn": "North Dakota",
        "code": "ND"
      },
      {
        "nameCn": "俄亥俄州",
        "nameEn": "Ohio",
        "code": "OH"
      },
      {
        "nameCn": "俄克拉荷马州",
        "nameEn": "Oklahoma",
        "code": "OK"
      },
      {
        "nameCn": "俄勒冈州",
        "nameEn": "Oregon",
        "code": "OR"
      },
      {
        "nameCn": "宾夕法尼亚州",
        "nameEn": "Pennsylvania",
        "code": "PA"
      },
      {
        "nameCn": "罗得岛州",
        "nameEn": "Rhode Island",
        "code": "RI"
      },
      {
        "nameCn": "南卡罗来纳",
        "nameEn": "South Carolina",
        "code": "SC"
      },
      {
        "nameCn": "南达科他",
        "nameEn": "South Dakota",
        "code": "SD"
      },
      {
        "nameCn": "田纳西州",
        "nameEn": "Tennessee",
        "code": "TN"
      },
      {
        "nameCn": "德克萨斯州",
        "nameEn": "Texas",
        "code": "TX"
      },
      {
        "nameCn": "犹他州",
        "nameEn": "Utah",
        "code": "UT"
      },
      {
        "nameCn": "佛蒙特州",
        "nameEn": "Vermont",
        "code": "VT"
      },
      {
        "nameCn": "弗吉尼亚州",
        "nameEn": "Virginia",
        "code": "VA"
      },
      {
        "nameCn": "华盛顿州",
        "nameEn": "Washington State",
        "code": "WA"
      },
      {
        "nameCn": "西弗吉尼亚州",
        "nameEn": "West Virginia",
        "code": "WV"
      },
      {
        "nameCn": "威斯康星州",
        "nameEn": "Wisconsin",
        "code": "WI"
      },
      {
        "nameCn": "怀俄明州",
        "nameEn": "Wyoming",
        "code": "WY"
      }
    ]
  },
  {
    "countryCode": "CA",
    "stateProvince": [
      {
        "nameCn": "阿尔伯达省",
        "nameEn": "Alberta",
        "code": "AB"
      },
      {
        "nameCn": "不列颠哥伦比亚省",
        "nameEn": "British Columbia",
        "code": "BC"
      },
      {
        "nameCn": "马尼托巴省",
        "nameEn": "Manitoba",
        "code": "MB"
      },
      {
        "nameCn": "新布仑兹维克",
        "nameEn": "New Brunswick",
        "code": "NB"
      },
      {
        "nameCn": "纽芬兰",
        "nameEn": "Newfoundland",
        "code": "NF"
      },
      {
        "nameCn": "西北地区",
        "nameEn": "Northwest China",
        "code": "NT"
      },
      {
        "nameCn": "新斯科舍",
        "nameEn": "nova scotia",
        "code": "NS"
      },
      {
        "nameCn": "纽那瓦",
        "nameEn": "Newava",
        "code": "NU"
      },
      {
        "nameCn": "安大略",
        "nameEn": "Ontario",
        "code": "ON"
      },
      {
        "nameCn": "爱德华王子岛",
        "nameEn": "Prince Edward Island",
        "code": "PE"
      },
      {
        "nameCn": "魁北克",
        "nameEn": "Quebec",
        "code": "QC"
      },
      {
        "nameCn": "萨斯喀彻温省",
        "nameEn": "Saskatchewan",
        "code": "SK"
      },
      {
        "nameCn": "育空地区",
        "nameEn": "Yukon",
        "code": "YT"
      }
    ]
  },
  {
    "countryCode": "AU",
    "stateProvince": [
      {
        "nameCn": "新南威尔士州",
        "nameEn": "New South Wales",
        "code": "NSW"
      },
      {
        "nameCn": "昆士兰州",
        "nameEn": "Queensland",
        "code": "QLD"
      },
      {
        "nameCn": "南澳大利亚州",
        "nameEn": "South Australia",
        "code": "SA"
      },
      {
        "nameCn": "塔斯马尼亚",
        "nameEn": "Tasmania",
        "code": "TAS"
      },
      {
        "nameCn": "维多利亚州",
        "nameEn": "Victoria",
        "code": "VIC"
      },
      {
        "nameCn": "西澳大利亚州",
        "nameEn": "Western Australia",
        "code": "WA"
      }
    ]
  }
]

export function getState () {
  // 329 UA
  // 332 CA
  // 339 AU
  const stateMap = {}

  for (const i of state) {
    const list = []
    for (const j of i.stateProvince) {
      list.push({
        label: `${j.code} (${j.nameEn})`,
        value: j.code
      })
    }

    let code = ''
    switch (i.countryCode) {
      case 'US':
        code = '329'
        break;
      case 'CA':
        code = '332'
        break;
      case 'AU':
        code = '339'
        break;
    }

    stateMap[code] = list
  }

  return stateMap
}